package gui.testSetup.components;

import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.TitledBorder;

/**
 *
 * @author William Whitney
 */
public class PageDescriptionViewer extends JPanel
{

    private JTextArea textArea;

    /**
     * Default constructor.
     * @param enumPageType
     */
    public PageDescriptionViewer(String text)
    {
        //Setup Panel
        this.setupPanel();

        //Setup scroll box
        this.addComponents();

        textArea.setText(text);

    }

    /**
     * Setup the JPanel.
     */
    public void setupPanel()
    {
        BorderLayout layout = new BorderLayout();
        this.setLayout(layout);

    }

    /**
     * Adds components to the view.
     */
    private void addComponents()
    {
        //Border
        TitledBorder border = new TitledBorder("Description");
        this.setBorder(border);

        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setBackground(this.getBackground());
        
        this.add(textArea, BorderLayout.CENTER);

    }

    /**
     * Sets the text of the viewer.
     * @param description
     */
    public void setText(String description)
    {
        textArea.setText(description);
    }
}
